public class hanluota {
    public static void move(char a1,char a2){
        System.out.println(a1+"->"+a2);
    }
    public static void han(int n,char pos1,char pos2,char pos3){
        if(n == 1){
            move(pos1,pos3);
        }
        else{
            han(n - 1,pos1,pos3,pos2);
            move(pos1,pos3);
            han(n - 1,pos2,pos1,pos3);
        }

    }

    public static void main(String[] args) {
        han(3,'A','B','C');
    }
}
